package stock;

import java.util.ArrayList;

public class Company {

	private String name;
	private float last;
	private ArrayList<Float> weekInfo;
	private float variation;
	private float porcentualVariation;
	private long volume;
	
	public Company(ArrayList<String> companyInformation){
		name = companyInformation.get(0);
		last = Float.parseFloat(companyInformation.get(1).replace(',', '.'));
		variation = Float.parseFloat(companyInformation.get(2).replace("+", "").replace(',', '.'));
		porcentualVariation = Float.parseFloat(companyInformation.get(3).replace(',', '.'));
		volume = Long.parseLong(companyInformation.get(4).replace(".", ""));
		weekInfo = new ArrayList<Float>();
	}

	public void print(){
		System.out.println("Name: "+this.name+" | Last: "+this.last+" | Variation: "+this.variation+
							" | Variation(%): "+this.porcentualVariation+" | Volume: "+this.volume);
		
		if (this.weekInfo.size() > 0){
			String weekInfo = "";
			for( Float info : this.weekInfo ){
				weekInfo += info+" - ";
			}
			System.out.println("Week Info: "+weekInfo);
		}
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public float getLast() {
		return last;
	}

	public void setLast(float last) {
		this.last = last;
	}

	public float getVariation() {
		return variation;
	}

	public void setVariation(float variation) {
		this.variation = variation;
	}

	public float getPorcentualVariation() {
		return porcentualVariation;
	}

	public void setPorcentualVariation(float porcentualVariation) {
		this.porcentualVariation = porcentualVariation;
	}

	public long getVolume() {
		return volume;
	}

	public void setVolume(long volume) {
		this.volume = volume;
	}
	
	public ArrayList<Float> getWeekInfo(){
		return this.weekInfo;
	}
	
	public void setWeekInfo(ArrayList<String> weekInfo){
		for (String infoValue : weekInfo){
			this.weekInfo.add(Float.parseFloat(infoValue.replace(',', '.')));
		}
	}
}
